import { createBrowserRouter, Navigate } from "react-router-dom";
import Main from "../pages/main";
import Home from "../pages/home";
import Mall from "../pages/mall";
import user from "../pages/user";
import PageOne from "../pages/other/pageOne";
import PageTwo from "../pages/other/pageTwo";
import Role from "../pages/system/role";
import path from "../pages/system/path";

const router = [
  {
    path: "/",
    Component: Main,
    children: [
      //重定向
      {
        path: "/",
        element: <Navigate to="/home"></Navigate>,
      },
      {
        path: "home",
        Component: Home,
      },
      {
        path: "Mall",
        Component: Mall,
      },
      {
        path: "user",
        Component: user,
      },
      {
        path: "Other",
        children: [
          {
            path: "pageOne",
            Component: PageOne,
          },
          {
            path: "pageTwo",
            Component: PageTwo,
          },
        ],
      },
      {
        path: "system",
        children: [
          {
            path: "Role",
            Component: Role,
          },
          {
            path: "path",
            Component: path,
          },
        ],
      },
    ],
  },
];

export default createBrowserRouter(router);
   